cssgadget: Compute relative to own allocation, not widget allocation
authorBenjamin Otte <otte@redhat.com>
Tue, 29 Nov 2016 10:32:45 +0000 (11:32 +0100)
committerBenjamin Otte <otte@redhat.com>
Mon, 5 Dec 2016 14:02:46 +0000 (15:02 +0100)
This would lead to clipped gadgets when the gadget allocation differed
from the widget allocation, like in GtkListBox.

gtk/gtkcssgadget.c

index 64b35063f1c20558174ccbb07c0ba5523ca83883..85a2d7fa211972e5e9873d6be96d2e8a689ae123 100644 (file)
@@ -127,21 +127,9 @@ gtk_css_gadget_get_clip (GtkCssGadget    *gadget,
 {
   GtkCssGadgetPrivate *priv = gtk_css_gadget_get_instance_private (gadget);
 
-  if (priv->owner && !gtk_widget_get_has_window (priv->owner))
-    {
-      GtkAllocation widget_alloc;
-      gtk_widget_get_allocation (priv->owner, &widget_alloc);
-
-      graphene_rect_init (bounds,
-                          priv->clip.x - widget_alloc.x, priv->clip.y - widget_alloc.y,
-                          priv->clip.width, priv->clip.height);
-    }
-  else
-    {
-      graphene_rect_init (bounds,
-                          priv->clip.x, priv->clip.y,
-                          priv->clip.width, priv->clip.height);
-    }
+  graphene_rect_init (bounds,
+                      priv->clip.x - priv->allocated_size.x, priv->clip.y - priv->allocated_size.y,
+                      priv->clip.width, priv->clip.height);
 }
 
 static gboolean